Skip to content

Conversation

@Jonahss
Copy link
Member

@Jonahss Jonahss commented Sep 26, 2014

This is just a merge of the "interfacesRefactor` branch, plus reimplementation of ScrollTo.

only doing this as a PR so that @bootstraponline and @TikhomirovSergey can review the scrollTo stuff

@bootstraponline
Copy link
Member

scroll code looks good. 👍

@TikhomirovSergey
Copy link
Contributor

Hi! Guys!
Scrolls are great! But there are some issues. They are logical. I'll show my improvements soon. Please wait for a bit time.

 Change log:
 
 - MobileElement has become abstract. It implements
FindsByAccessibilityId
 
 - AndroidElement and IOSElement have been created. 
 
 - AndroidElement implements FindsByAndroidAutomator.
 
 - IOSElement implements FindsByIosAutomation.
 
 - Both AppiumDriver and MobileElement implement ScrollsTo. Yeah!
MobileElement is scrollable too!
 
 - PageFactory facilities are synchronized with changes above.
@TikhomirovSergey
Copy link
Contributor

Please look at Jonahss#1

It is from one more temporary fork. Please merge it if it is ok.

@TikhomirovSergey
Copy link
Contributor

I have changed scrollTo and scrollToExact. They return MobileElement. I think it is possible that somebody wants to do something with element. So why does it need to perform search twice?

@Jonahss
Copy link
Member Author

Jonahss commented Sep 26, 2014

@TikhomirovSergey What do you think of that? Removing scrollTo() from AndroidElement since we aren't changing the scrolling context (it's always the first .scrollable(true) element). If a user needs to scroll something else, they will have to use the UiSelectors themselves.

In the future, if we can come up with a good unified way of scrolling on iOS and Android, we could try to implement it into Appium itself.

@TikhomirovSergey
Copy link
Contributor

Hmm... Ok. Let remove it from AndroidElement. But if it needs to be implemented in the future it is always possible to get back to this idea :)

@TikhomirovSergey
Copy link
Contributor

If there is any question I shall return over 2 hours.

@Jonahss
Copy link
Member Author

Jonahss commented Sep 26, 2014

I already removed it, look at my latest commit.
I'll wait two hours :)

On Fri, Sep 26, 2014 at 11:41 AM, Sergey Tikhomirov <
notifications@github.com> wrote:

If there is any questions I shall return over 2 hours.


Reply to this email directly or view it on GitHub
#116 (comment).

@TikhomirovSergey
Copy link
Contributor

I already removed it, look at my latest commit.

It is ok! I have seen it.

If there is any question I shall return over 2 hours.
I'll wait two hours :)

Actually I meant some questions, issues which could be found and so on. :) But if there is nothing to discuss lets merge it.

Have a nice day!

@Jonahss
Copy link
Member Author

Jonahss commented Sep 26, 2014

Wahoooooo!
Running tests...

On Fri, Sep 26, 2014 at 2:02 PM, Sergey Tikhomirov <notifications@github.com

wrote:

I already removed it, look at my latest commit.

It is ok! I have seen it.

If there is any question I shall return over 2 hours.
I'll wait two hours :)

Actually I meant some questions, issues which could be found and so on. :)
But if there is nothing to discuss lets merge it!


Reply to this email directly or view it on GitHub
#116 (comment).

@Jonahss
Copy link
Member Author

Jonahss commented Sep 26, 2014

@TikhomirovSergey this test fails, what would you suggest?

@Test
    public void isRemoteElementTest(){
        Assert.assertNotEquals(null, remotetextVieW.getAttribute("text"));
    }
org.openqa.selenium.NoSuchElementException: Cann't locate an element by this strategy: By.AndroidUIAutomator: new UiSelector().resourceId("android:id/text1")
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.43.1', revision: '5163bceef1bc36d43f3dc0b83c88998168a363a0', time: '2014-09-10 09:43:55'
System info: host: 'Jonahs-MacBook-Air.local', ip: '10.35.4.71', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.4', java.version: '1.7.0_67'
Driver info: driver.version: unknown
    at io.appium.java_client.pagefactory.AppiumElementLocator.findElement(AppiumElementLocator.java:132)
    at io.appium.java_client.pagefactory.ElementInterceptor.intercept(ElementInterceptor.java:26)
    at org.openqa.selenium.remote.RemoteWebElement$$EnhancerByCGLIB$$5e30ad6f.getAttribute(<generated>)
    at io.appium.java_client.pagefactory_tests.AndroidPageObjectTest.isRemoteElementTest(AndroidPageObjectTest.java:236)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runners.Suite.runChild(Suite.java:127)
    at org.junit.runners.Suite.runChild(Suite.java:26)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

@TikhomirovSergey
Copy link
Contributor

I am trying to find the root cause. Is it the single failure? Did you try to rerun this test? I ran page object android tests. There were no failure. It is strange...

@TikhomirovSergey
Copy link
Contributor

By default Appium Field Decorator has 1 second as default time out. Is it possible that element weren't present after 1 second? Actually I use Genymotion instead of Android SDK emulator (it is too slow).

@TikhomirovSergey
Copy link
Contributor

@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/text1\")")
private List<RemoteWebElement> remoteElementViews;


@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"android:id/text1\")")
private RemoteWebElement remotetextVieW;

Here is the test which checks the list:

        @Test
    public void areRemoteElementsTest(){
        Assert.assertNotEquals(0, remoteElementViews.size());
    }

It has passed.

@TikhomirovSergey
Copy link
Contributor

I think it is casual failure. If there is only this problem then identical test should be succeed with iOS here:

        @Test
    public void isRemoteElementTest(){
        Assert.assertNotEquals(null, remotetextVieW.getText());
    }

@TikhomirovSergey
Copy link
Contributor

Let replace string

PageFactory.initElements(new AppiumFieldDecorator(driver), this);

by

PageFactory.initElements(new AppiumFieldDecorator(driver, 5, TimeUnit.SECONDS), this);

in AndroidPageObjectTest

Anyway tests with default time out are here and here

@TikhomirovSergey
Copy link
Contributor

did it help you?

@TikhomirovSergey
Copy link
Contributor

My answer is here: Jonahss#2

@TikhomirovSergey
Copy link
Contributor

What are you think about inclusion of information about Genymotion use cases in tutorial ? Have you tried it?

It works much faster than Android SDK emulator and ADB recognizes it as a connected device.

@Jonahss
Copy link
Member Author

Jonahss commented Sep 29, 2014

Official Appium tests are run on Android SDK Emulators and we only officially support it.
Genymotion is fine, but if there are specific bugs with it, we can't support them. Unless somebody wants to add Genymotion support to appium :)

@Jonahss
Copy link
Member Author

Jonahss commented Sep 29, 2014

But you can add it to the tutorial sure ^.^ if it works.

AndroidPageObjectTest improvement.
Jonahss added a commit that referenced this pull request Sep 29, 2014
@Jonahss Jonahss merged commit dbb443a into appium:master Sep 29, 2014
@TikhomirovSergey
Copy link
Contributor

Wow! It is released. Thanks, @Jonahss!

Appium works fine with Genymotion. I am not kidding you :) At least all java-client tests for Android are completed successfully, except set/get connection. Sometimes they fail because of an unknown to me reason. There is nothing special to do.

@TikhomirovSergey
Copy link
Contributor

I hope people will appreciate the new solution :)

@Jonahss
Copy link
Member Author

Jonahss commented Sep 30, 2014

:D

Feel free to add the genymotion tutorial then :)

On Tue, Sep 30, 2014 at 12:38 AM, Sergey Tikhomirov <
notifications@github.com> wrote:

I hope people will appreciate the new solution :)


Reply to this email directly or view it on GitHub
#116 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants